package org.richin.web.struts.util;

import java.util.Date;

import org.apache.commons.beanutils.Converter;
import org.richin.date.util.DateFormatUtils;
import org.richin.date.util.DateUtils;

public class UtilDateConverter implements Converter {

	public Object convert(Class type, Object value) {
		if (null == value) {
			return value;
		}
		if (value instanceof Date) {
			return value;
		}
		Date d = null;
		if (value instanceof String) {
			d = DateFormatUtils.parseFromFormats("" + value);
		}
		return d;
	}

}
